<template>
	<div @click.stop="onClickHandler()" style="margin-top:5px;position: relative;" :class="[selected ?'grouptitle-selected-state ' : 'grouptitle-normal-state ']">
		<i class="el-icon-rank drag-widget" style="position: absolute;left: 0px;top:0px;z-index: 100;" v-show="selected"></i>
		<span style="font-size:18px;color:#7C7BAD;">{{componentModel.title}}</span>
	</div>
</template>

<script>
	import utils from '@/utils/utils.js';
	import formDesignerUtil from '@/utils/formDesignerUtil.js';
	export default {
		name: "DesignGroupTitleComponent",
		props: [
			"componentModel"
		],
		data() {
			return {
				selected:false,
				"propertySet": [
					{
						"key": "ID","label":"ID","editor":"label"
					},{
						"key": "title","label":"标题","editor":"text",
					}
				],
			}
		},inject:['children'],
		mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		},
		methods: {
			onClickHandler() {
				formDesignerUtil.componentClickHandler(this);
			},setSelected(selected){
				this.selected=selected;	
			},getPropertyValue(propertyKey){
				if(propertyKey=="ID"){
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"id");
				}else if (propertyKey == "title") {
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"title");
				}
				return formDesignerUtil.getComponentModelCommonValue(this.componentModel,propertyKey);
			},setPropertyValue(propertyKey,propertyValue){
				formDesignerUtil.setComponentModelCommonValue(this.componentModel,propertyKey, propertyValue);
				if(propertyKey=="title"){
					formDesignerUtil.setComponentModelPropValue(this.componentModel,"title",propertyValue);
				}
			}
		}
	}
</script>

<style>
	
</style>

